#include "INC.h"

Menu_param menu_param = {0};

void menu_init(void)
{
    menu_param.rounds = 1;
    // OLED显示
    char msg[20] = {0};
    sprintf(msg, "   EDA-25 CAR  ");
    OLED_ShowString(0, 0, (uint8_t *)msg, 8);
    sprintf(msg, " Rounds:%d  ", menu_param.rounds);
    OLED_ShowString(0, 1, (uint8_t *)msg, 8);
}
void parse_menu_command(uint8_t key_0)
{
    // 解析菜单命令并执行相应操作
    if (key_0 == 1)
    {
        menu_param.rounds = (menu_param.rounds + 1) % 6;
        if (menu_param.rounds == 0)
        {
            menu_param.rounds = 1;
        }
        char msg[20] = {0};
        // OLED显示
        OLED_Clear();
        sprintf(msg, "   EDA-25 CAR  ");
        OLED_ShowString(0, 0, (uint8_t *)msg, 8);
        sprintf(msg, " Rounds:%d  ", menu_param.rounds);
        OLED_ShowString(0, 1, (uint8_t *)msg, 8);
        
    }
}
uint8_t get_menu_rounds(void)
{
    return menu_param.rounds;
}